Vue.directive('focus', {
    inserted: function (el) {
    el.focus()
    }
});

var app = new Vue({
	el: "#app",
	components: route,
	mixins: [mixin],
	data: function () {
		return {
		    title: '憨匠公社 - 靠谱的弱电人集结地',
		    setting: {
                title: {
                    bgColor: '#ca4841',
                    border: '1px solid #ca4841',
                    color: '#ffffff'
                }  
		    },
			showMenu: true,
			showMenuIndex: [0,3,5],
			fromList: [0,1,3,4,5,16,17], //显示来源的
			scrollList: [0, 1, 3, 15, 16],  //缓存滚动条位置
			showNoLogin: [0,1,3,15],        //不需要登录的页面
			showTips: false,
			showWin: false,
			showMsg: false,
			menuIndex: -1,
			tipsType: '',
			pageId: 'index',
			pageArr: [],
			pageArrString: ['index', 'job'],
			fromIndex: 0,
			tipsMsg: '',
			page: '',
			menu: [
				{ title: '首页', icon: '&#xe8a0;', id:0 },
				{ title: '招工', icon: '&#xea0f;', id:1 },
				{ title: '发布', icon: '&#xe810;', id:-1 },
				{ title: '消息', icon: '&#xea25;', id:2 },
				{ title: '我的', icon: '&#xe89d;', id:3 }
			],
			menus: [],
			user: {},
			rnd: Math.random(),
			dataUrl: '',
			env: '',
			sys: '',
			loc:{},
			showPublishType:false,
			mapKey: 'NMZBZ-AVT3K-NBSJH-AXJPS-NMTS5-C5BDP',
			locpicker: 'https://hanjiang.leantong.com/component/map/qq/locpicker.html?key=NMZBZ-AVT3K-NBSJH-AXJPS-NMTS5-C5BDP&search=1&type=1&referer=myapp&v=2',
			debug: false //开启显示pageId
		//	test: new Test()
		};
	},
	methods: {
	    tips: function (msg, time = 3, type = '', stop = 1) {
	        
    			var t = this;
    			t.tipsMsg = msg;
    			t.showTips = true;
    			t.tipsType = type;
    			t.timer = setInterval(() => {
    				time--;
    				if (time === 0) {
    					t.tipsMsg = '';
    					t.showTips = false;
    					t.tipsType = '';
    					clearInterval(t.timer);
    				}
    			}, 1000);
    			if (stop === 1) {
    			    throw SyntaxError()
    			}
	 
		},
	}
});